gboolean selectable;
GtkDirectionType direction;
GtkCellArea *cell_area = NULL;
+ GtkCellRenderer *last_focus_cell = NULL;
GtkTreeIter iter;
if (! gtk_widget_has_focus (GTK_WIDGET (tree_view)))
direction = count < 0 ? GTK_DIR_UP : GTK_DIR_DOWN;
-
if (tree_view->priv->focus_column)
cell_area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (tree_view->priv->focus_column));
&iter,
GTK_RBNODE_FLAG_SET (cursor_node, GTK_RBNODE_IS_PARENT),
cursor_node->children?TRUE:FALSE);
-
+
+ /* Save the last cell that had focus, if we hit the end of the view we'll give
+ * focus back to it. */
+ last_focus_cell = gtk_cell_area_get_focus_cell (cell_area);
+
+ /* If focus stays in the area, no need to change the cursor row */
if (gtk_cell_area_focus (cell_area, direction))
return;
}
{
gtk_widget_error_bell (GTK_WIDGET (tree_view));
}
+
+ if (cell_area)
+ gtk_cell_area_set_focus_cell (cell_area, last_focus_cell);
}
if (grab_focus)
gboolean found_column = FALSE;
gboolean rtl;
GtkDirectionType direction;
- GtkCellArea *cell_area;
+ GtkCellArea *cell_area;
+ GtkCellRenderer *last_focus_cell = NULL;
+ GtkCellArea *last_focus_area = NULL;
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
list = rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns);
if (tree_view->priv->focus_column)
{
+ /* Save the cell/area we are moving focus from, if moving the cursor
+ * by one step hits the end we'll set focus back here */
+ last_focus_area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (tree_view->priv->focus_column));
+ last_focus_cell = gtk_cell_area_get_focus_cell (last_focus_area);
+
for (; list; list = (rtl ? list->prev : list->next))
{
if (list->data == tree_view->priv->focus_column)
else
{
gtk_widget_error_bell (GTK_WIDGET (tree_view));
+
+ if (last_focus_area)
+ gtk_cell_area_set_focus_cell (last_focus_area, last_focus_cell);
}
gtk_tree_view_clamp_column_visible (tree_view,